package com.itheima.myextends.homework07;

/*
            结合继承的思想，分析下列需求并实现
            定义项目经理类Manager 【属性：姓名 工号 工资 奖金】【行为：工作work】
            定义程序员类Coder【属性：姓名 工号 工资】【行为：工作work】
            要求：通过有参构造创建两个类的对象，并调用各自的work方法
            运行结果：
                姓名为:张三,工号为:9527,工资为:10000.0,的程序员正在编写代码
                姓名为:李四,工号为:9528,工资为:15000.0,奖金为:2000.0,的项目经理正在管理程序员写代码
 */

 class staff {
    private String name;
    private int number;
    private double salary;

    public staff() {
    }

    public staff(String name, int number, double salary) {
        this.name = name;
        this.number = number;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public void work(){
    }
}
class Manager extends staff {
    private double bonus;

    public Manager() {
    }

    public Manager(String name, int number, double salary, double bonus) {
        super(name, number, salary);
        this.bonus = bonus;
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(int bonus) {
        this.bonus = bonus;
    }

    @Override
    public void work() {
        System.out.println("姓名为:"+getName()+",工号为:"+getNumber()+",工资为:"+getSalary()+",奖金为:"+getBonus()+",的项目经理正在管理程序员写代码");
    }
}
class Coder extends staff {
    public Coder() {
    }

    public Coder(String name, int number, double salary) {
        super(name, number, salary);
    }

    @Override
    public void work() {
        System.out.println("姓名为:"+getName()+",工号为:"+getNumber()+",工资为:"+getSalary()+",的程序员正在编写代码");
    }
}
public class Demo07 {
    public static void main(String[] args) {
        Manager m = new Manager("李四",9528,15000.0,2000.0);
        Coder c = new Coder("张三",9527,10000.0);
        c.work();
        m.work();
    }
}
